package cn.dongjak.example.spring.security.vo;

import cn.dongjak.example.spring.security.domain.ExampleUser;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

@RequiredArgsConstructor
public class ExampleUserPrincipal implements UserDetails {

    @NonNull
    private ExampleUser exampleUser;


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return exampleUser.getPassword();
    }

    @Override
    public String getUsername() {
        return exampleUser.getUsername();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return exampleUser.isEnabled();
    }
}
